﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.ObjectModel;
using Highchart.Core.Appearance;
using Highchart.Core.Data.Chart;
using Highchart.Core;
using Highchart.Core.Events;
using Newtonsoft.Json;
using VerticalAlign = Highchart.Core.VerticalAlign;

namespace Highchart.Web
{
    public partial class Sample11 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Exemplo11();
        }

        private void Exemplo11()
        {
            
            //definições de eixos
            YAxisItem _yAxisItem = new YAxisItem(){ title = new Title("Faturamento") };
            _yAxisItem.plotLines = new PlotLines
                                       {
                                           new PlotLine()
                                               {
                                                   label = new PlotLabel() {text = "Plot Line Label"},
                                                   value = 500,
                                                   dashStyle = DashStyle.Solid,
                                                   width = 2,
                                                   color = "#000"
                                               }
                                       };
            _yAxisItem.plotBands = new PlotBands
                                       {
                                           new PlotBand()
                                               {
                                                   label = new PlotLabel() {text = "Plot Band Label", verticalAlign = VerticalAlign.bottom, y = -10},
                                                   from = 700,
                                                   to = 1000,
                                                   color = "#D6F5D6"
                                               }
                                       };

            hcVendas.YAxis.Add(_yAxisItem);
            
            
            hcVendas.XAxis.Add(new XAxisItem { categories = new[] { "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" } });

            //Add data to serie
            var series = new Collection<Serie>();
            series.Add(new Serie() { data = new object[] { 400, 435, 446, 479, 554, 634, 687, 750, 831 }});
            hcVendas.PlotOptions = new Core.PlotOptions.PlotOptionsLine { dataLabels = new Core.PlotOptions.DataLabels { enabled = true } };
            
            //Bind the control
            hcVendas.DataSource = series;
            hcVendas.DataBind();

        }

    }
}
